<!DOCTYPE html>
<html>
  <head>
    <title>我的管家</title>
	
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="keyword1,keyword2,keyword3">
    <meta name="description" content="this is my page">
    <meta name="content-type" content="text/html; charset=UTF-8">
	<meta charset="utf-8">
	<meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
  </head>
  <link href="../jsp/css/myGuanjia.css" rel="stylesheet">
<link rel="stylesheet" href="./css/sm.min.css">
<link rel="stylesheet" href="./css/sm-extend.min.css">
<script src="../js/jquery-2.1.1.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="../js/min/modernizr-custom-v2.7.1.min.js" type="text/javascript"></script>
<script src="../js/min/hammer-v2.0.3.min.js" type="text/javascript"></script>
<script src="./js/zepto.js"></script>
<script src="./js/sm.js" ></script>
<script src="../js/common.js"></script>
<script src="./js/sm-extend.js" ></script>
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
<script src="js/pointlog.js"></script> 
<script type="text/javascript">
window.$$=window.Zepto = Zepto;
/*获取到Url里面的参数*/
(function ($) {
  $.getUrlParam = function (name) {
   var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
   var r = window.location.search.substr(1).match(reg);
   if (r != null) return unescape(r[2]); return null;
  }
 })(jQuery);
var agreementType ="";
var status = $.getUrlParam('status');
var contractId = $.getUrlParam('contractId');
$(function() {
	getUserInfo();
    $("#zhankai").click(function() {
        $(this).text($("#yincang").is(":hidden") ? "收起" : "展开");
       $("#yincang").slideToggle();
    });
});
function getCookie(name) 
{ 
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
 
    if(arr=document.cookie.match(reg))
 
        return unescape(arr[2]); 
    else 
        return null; 
} 
function initGuanjia(){
	$.ajax({
		type: "POST",
		dataType: "json",
		url: "../user/getMyGuanJia.do?rnd="+ Math.random(),
		data: {
			'agreementType':agreementType,
			'status':status,
			'contractId' : contractId
		},
		success: function(data){
			console.log(data)
			if( data.resultCode==0 && data.content ){
				var obj = data.content;
				$("#headImg").attr("src",obj.household.headUrl.split(",")[0]||'../images/user1.png');
				$("#jobName").html(obj.household.jobName||'蓝居小管家');
				$("#nickName").html(obj.household.nickName||obj.household.phone);
				$("#phone").attr("href","tel:"+obj.phone);
				var msg = (obj.household.introduction||'此管家很懒，什么都没有留下.');
				$(".chengnuo").show();
				if(msg.length<20){
					$("#msg1").html(msg);
				}else{
					$("#msg1").html(msg.substr(0,20)+'&nbsp; <a id="zhankai">展开</a>');
					$("#msg2").html(msg.substr(20));
				}
			}else{
// 				$$.toast("未获取到我的管家信息");
// 				$("#bodyDiv").html("暂无管家信息");
				$(".bottom").hide();
// 				$("#allinfo").hide();
				$("#allinfo").html( '<ul style="list-style: none"><li  style=\'text-align:center;background: #fff;\'><img src=\"../images/nondata.png\"></li><li style=\'text-align:center;background: #fff;\'>还没有签合同，暂无管家数据</li><ul>' );
			}
		},
		error: function(e) {
			$("#allinfo").hide();
			$$.toast("系统出错");
		}
	});
}

  function getUserInfo(){
	$.ajax({
		type : "POST",
		dataType : 'json',
		url : "../user/isLogin.do",
		data : {
			'phone' :getCookie("phone")
		},
		success : function(data) {
			if(data.success){
				agreementType=data.user.flag;
				initGuanjia();
			}
		}
	});
	
}
  var args=ponitLog.getWindowsParam();
  console.log(args);
</script>
  
  <body style="background: #fff;">
  <header class="bar bar-nav">
<!-- 	    <a class="button button-link button-nav pull-left" href="javaScript:history.go(-1)" data-transition='slide-out'> -->
<!-- 	      <span class="icon icon-left"></span> -->
<!-- 	      返回 -->
<!-- 	    </a> -->
	    <h1 class="title">我的管家</h1>
	  </header>
    <div style="height: 100%;background: #fff;margin-top: 60px;" id="allinfo">
    <div class="guanjia_info">
    <ul >
    <li>
    <img id="headImg" class="guanjia_info_img" src="../images/guanjia.jpg" style="width: 140px;height: 160px;"></li>
    <li style="width: 150px ;height: 160px;margin:-160px 0px 0px 160px; padding-top: 18px;">
    <span id="nickName" style="font-size: 16px;"><!-- 刘笙笙 --></span><br>
    <span>职务：</span><span id="jobName"></span><br>
<!--     <span>服务经验：</span><span id="jobYear"></span><br> -->
<!--     <span style="color: #FF9900; font-size: 11px;border-radius:5px;border: 0.5px solid #FF9900;margin: 2px 2px 2px 2px;padding: 2px 2px 2px 2px;">金牌管家</span> -->
    </li>
    </ul>
    </div>
    <div style="margin: 20px 10px 10px 15px;width: 90%;">
    <p style="font-size: 15px;margin-bottom:.2rem;">管家自我介绍</p>
    <p style="width: 98%;font-size: 12px;margin-top: 0;"  id="msg1">还没有签合同，暂无管家信息</p>
    <div id="yincang" style="display: none;">
    <p style="width: 98%;font-size: 13px;" id="msg2"><p></div>
    </div>
    
<!-- <div class="rongyu">
    <p style="font-size: 18px;">TA的荣耀</p>
    <ul>
    <li>
    <span><img src="<%=basePath%>images/guanjia/jinpai.png" style="width: 32px;height: 32px;margin:15px 0px 5px 18%;"><br>金牌管家奖</span>
    </li>
    <li style="margin:-54px 0px 0px 28%;">
    <span><img src="<%=basePath%>images/guanjia/renqi.png" style="width: 32px;height: 32px; margin:-5px 0px 5px 15%;"><br>最佳人气奖</span>
    </li>
    <li style="margin:-54px 0px 0px 56%;">
    <span><img src="<%=basePath%>images/guanjia/weixiao.png" style="width: 30px;height: 30px; margin:-3px 0px 5px 15%;"><br>微笑服务奖</span>
    </li>
    </ul>
    
    </div>  -->
    
    <div class="chengnuo" style="display: none">
    <p style="font-size: 15px;margin-bottom: .3rem;">承诺</p>
     <ul>
    <li>
    <span><img src="../images/guanjia/tiexin.png" style="width: 48px;height: 48px;margin:5px 0px 0px 5%;"><br>贴心服务</span>
    </li>
    <li style="margin:-70px 0px 0px 30%;">
    <span><img src="../images/guanjia/pinzhi.png" style="width: 38px;height: 38px;margin:-5px 0px 5px 10%;"><br>品质保障</span>
    <li style="margin:-70px 0px 0px 60%;">
    <span><img src="../images/guanjia/zhiliang.png" style="width: 38px;height: 38px;margin:-5px 0px 5px 10%;"><br>质量承诺</span>
    </li>
    </ul>
    </div>
    
    </div>
    <div class="bottom">
      <ul>
					<!-- <li><a href="<%=path%>/lanju/myGuanjia.jsp"><input type="submit"
							name="pingjia" value="评价TA" /></a></li> -->
					<li>
            <a href="javascript:;" id="phone"><input type="submit" name="lianxi" value="联系TA"/></a></li>
				</ul>
			</div>

    
  </body>
</html>
